import { flushGame } from "./Home";

export class Win {
    protected _view: fgui.GComponent;
    constructor() {
        this._view = fgui.UIPackage.createObject("home", "Win").asCom
        this._view.makeFullScreen();
        fgui.GRoot.inst.addChild(this._view);
        this._view.getChild('btn').onClick(this, () => {
            this._view.visible = false;
            flushGame()
        })
    }

    show(){
        this._view.visible = true;
    }

}

let win: Win;
export function showWin() {
    if (!win) {
        win = new Win()
    } else {
        win.show()
    }

}
